﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _16_EF
{
    public class MyDbContextDesignFactory : IDesignTimeDbContextFactory<MyDbContent>
    {
        // 开发是运行，（add-migragion,update-database 等）用的
        public MyDbContent CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<MyDbContent> builder = new DbContextOptionsBuilder<MyDbContent>();
            builder.UseSqlServer("Data Source=.;database=coreTest;Integrated Security=sspi;");
            MyDbContent ctx = new MyDbContent(builder.Options);
            return ctx;
        }
    }
}
